package com.museum.demo.Controller;

import com.museum.demo.Entity.CollectionEntity;
import com.museum.demo.Interface.Result;
import com.museum.demo.Service.CollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Collection")
@Api("对藏品进行操作")
public class CollectionController {

    @Autowired
    private CollectionService collectionService;

    @ApiOperation(value="根据博物馆寻找名下的藏品")
    @PostMapping("/GetCollectionByMuseumName") //List<CollectionEntity>
    public Result GetCollectionByMuseumName(@RequestParam String museumname){
        List<CollectionEntity> result = collectionService.SearchCollectionList(museumname);

        if(result != null){
            return Result.Success(result);
        }

        return Result.Search_Fail();
    }
}
